import { http } from '@/services/request'
const prefix = `${import.meta.env.VITE_API_PREFIX}`

// 新增
export function postObj(data: any) {
  return http.request({
    url: `${prefix}/system/area`,
    method: 'POST',
    data,
  })
}

// 删除
export function deleteObj(id: number) {
  return http.request({
    url: `${prefix}/system/area/${id}`,
    method: 'DELETE',
  })
}

// 修改
export function putObj(data: any) {
  return http.request({
    url: `${prefix}/system/area/${data.id}`,
    method: 'PUT',
    data,
  })
}

// 查询
export function getObj(id: number) {
  return http.request({
    url: `${prefix}/system/area/${id}`,
    method: 'GET',
  })
}

// 列表
export function getList(params: any) {
  return http.request({
    url: `${prefix}/system/area`,
    method: 'GET',
    params,
  })
}

// 分页
export function getPage(params: any) {
  return http.request({
    url: `${prefix}/system/area`,
    method: 'GET',
    params,
  })
}

// 列表
export function getTree(params: any) {
  return http.request({
    url: `${prefix}/system/area/tree`,
    method: 'GET',
    params,
  })
}

// 编码校验
export function checkCode(params: any) {
  return http.request({
    url: `${prefix}/system/area/checkcode`,
    method: 'GET',
    params,
  })
}
